package org.boyan.common.util.jsonschema;

import com.alibaba.fastjson.JSONObject;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class b {
    private static final Logger a = LoggerFactory.getLogger(b.class);

    public static JSONObject a(JsonSchemaDescrip paramJsonSchemaDescrip, List<CommonProperty> paramList) {
        JSONObject jSONObject1 = new JSONObject();
        jSONObject1.put("$schema", paramJsonSchemaDescrip.get$schema());
        jSONObject1.put("type", paramJsonSchemaDescrip.getType());
        jSONObject1.put("title", paramJsonSchemaDescrip.getTitle());
        List<String> list = paramJsonSchemaDescrip.getRequired();
        jSONObject1.put("required", list);
        JSONObject jSONObject2 = new JSONObject();
        for (CommonProperty commonProperty : paramList) {
            Map<String, Object> map = commonProperty.getPropertyJson();
            jSONObject2.put(map.get("key").toString(), map.get("prop"));
        }
        jSONObject1.put("properties", jSONObject2);
        return jSONObject1;
    }

    public static JSONObject a(String paramString, List<String> paramList, List<CommonProperty> paramList1) {
        JSONObject jSONObject1 = new JSONObject();
        jSONObject1.put("type", "object");
        jSONObject1.put("view", "tab");
        jSONObject1.put("title", paramString);
        if (paramList == null) {
            paramList = new ArrayList<>();
        }
        jSONObject1.put("required", paramList);
        JSONObject jSONObject2 = new JSONObject();
        for (CommonProperty commonProperty : paramList1) {
            Map<String, Object> map = commonProperty.getPropertyJson();
            jSONObject2.put(map.get("key").toString(), map.get("prop"));
        }
        jSONObject1.put("properties", jSONObject2);
        return jSONObject1;
    }
}
